<?php
/* SVN FILE: $Id: multipleEffects.php 204 2009-09-06 23:17:44Z supersmashbrothers $ */
/**
* ibMarket 2
* IP.Board 3.0
* Making the Multiple Effects for an item
*
* @author $Author: supersmashbrothers $
* @copyright $Copyright$
* @version $Revision: 204 $
* @lastrevision $Date: 2009-09-06 23:17:44 +0000 (Sun, 06 Sep 2009) $
* @modifiedby $LastChangedBy: supersmashbrothers $
* @lastmodified $LastChangedDate: 2009-09-06 23:17:44 +0000 (Sun, 06 Sep 2009) $
* @filesource $URL: http://ipb-ibmarket.googlecode.com/svn/ibmarket2/trunk/admin/applications_addon/other/ibmarket/sources/multipleEffects.php $
*/

final class multipleEffects
{
	public static function getPrefix($effects)
	{
		$effects = is_array($effects) ? $effects : array();
		$prefix = "";
		foreach($effects as $type => $effect)
		{
			if($type == 'bold')
			{
				$prefix .= "<span style=\"font-weight:bold\">";
			}
			elseif($type == 'italics')
			{
				$prefix .= "<span style=\"font-style:italic\">";
			}
			elseif($type == 'color')
			{
				$prefix .= "<span style=\"color:{$effect['color']}\">";
			}
			elseif($type == 'background')
			{
				$prefix .= "<span style=\"background-color:{$effect['color']}\">";
			}
			elseif($type == 'dropshadow')
			{
				$prefix .= "<span style=\"display:inline-block; filter:dropshadow(color={$effect['color']}, offx={$effect['offx']}, offy={$effect['offy']}, Positive=".($effect['drop_background'] ? 'true' : 'false').")\">";
			}
			elseif($type == 'shadow')
			{
				$prefix .= "<span style=\"display:inline-block; filter:shadow(color={$effect['color']}, direction={$effect['direction']})\">";
			}
			elseif($type == 'glow')
			{
				$prefix .= "<span style=\"display:inline-block; filter:glow(color={$effect['color']}, strength={$effect['strength']})\">";
			}
			elseif($type == 'blur')
			{
				$prefix .= "<span style=\"display:inline-block; filter:blur(add=".($effect['show_text'] ? 'true' : 'false').", direction={$effect['direction']}, strength={$effect['strength']})\">";
			}
			elseif($type == 'flipv')
			{
				$prefix .= "<span style=\"display:inline-block; filter:flipv\">";
			}
			elseif($type == 'fliph')
			{
				$prefix .= "<span style=\"display:inline-block; filter:fliph\">";
			}
			elseif($type == 'wave')
			{
				$prefix .= "<span style=\"display:inline-block; filter:wave(strength={$effect['strength']})\">";
			}
			elseif($type == 'xray')
			{
				$prefix .= "<span style=\"display:inline-block; filter:xray\">";
			}
			elseif($type == 'invert')
			{
				$prefix .= "<span style=\"display:inline-block; filter:invert\">";
			}
		}
		
		return $prefix;
	}
	
	public static function getSuffix($effects)
	{
		$effects = is_array($effects) ? $effects : array();
		
		return str_repeat("</span>",count($effects));
	}
}
